package 线程池;

import java.text.SimpleDateFormat;
import java.util.Date;

public class MyRunnable implements Runnable {
    String commond;
    public MyRunnable(String i) {
        this.commond=i;
    }
    SimpleDateFormat sf=new SimpleDateFormat("yyyy-mm-dd hh-mm-ss");

    @Override
    public void run() {

        try {
            System.out.println(Thread.currentThread().getName() + "start time   " + sf.format(new Date()));
            Thread.sleep(2000);
            System.out.println(Thread.currentThread().getName()+"end time   "+ sf.format(new Date()));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Override
    public String toString() {
        return "MyRunnable{" +
                "commond='" + commond + '\'' +
                '}';
    }
}
